package com.jiegui.pay.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jiegui.common.annotation.Log;
import com.jiegui.common.core.controller.BaseController;
import com.jiegui.common.core.domain.AjaxResult;
import com.jiegui.common.enums.BusinessType;
import com.jiegui.pay.domain.OrderChannelInfo;
import com.jiegui.pay.service.OrderChannelInfoService;
import com.jiegui.common.utils.poi.ExcelUtil;
import com.jiegui.common.core.page.TableDataInfo;

/**
 * 通道信息Controller
 * 
 * @author wuqicheng
 * @date 2021-12-10
 */
@RestController
@RequestMapping("/pay/orderChannelInfo")
public class OrderChannelInfoController extends BaseController
{
    @Resource
    private OrderChannelInfoService orderChannelInfoService;

    /**
     * 查询通道信息列表
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(OrderChannelInfo orderChannelInfo)
    {
        startPage();
        List<OrderChannelInfo> list = orderChannelInfoService.selectOrderChannelInfoList(orderChannelInfo);
        return getDataTable(list);
    }

    /**
     * 导出通道信息列表
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:export')")
    @Log(title = "通道信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(OrderChannelInfo orderChannelInfo)
    {
        List<OrderChannelInfo> list = orderChannelInfoService.selectOrderChannelInfoList(orderChannelInfo);
        ExcelUtil<OrderChannelInfo> util = new ExcelUtil<OrderChannelInfo>(OrderChannelInfo.class);
        return util.exportExcel(list, "通道信息数据");
    }

    /**
     * 获取通道信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(orderChannelInfoService.selectOrderChannelInfoById(id));
    }

    /**
     * 新增通道信息
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:add')")
    @Log(title = "通道信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderChannelInfo orderChannelInfo)
    {
        return toAjax(orderChannelInfoService.insertOrderChannelInfo(orderChannelInfo));
    }

    /**
     * 修改通道信息
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:edit')")
    @Log(title = "通道信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderChannelInfo orderChannelInfo)
    {
        return toAjax(orderChannelInfoService.updateOrderChannelInfo(orderChannelInfo));
    }

    /**
     * 删除通道信息
     */
    @PreAuthorize("@ss.hasPermi('pay:orderChannelInfo:remove')")
    @Log(title = "通道信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(orderChannelInfoService.deleteOrderChannelInfoByIds(ids));
    }
}
